﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;

namespace bstest
{
    public partial class FormAnsShowWithShape : Form
    {
		//显示主程序
        public FormAnsShowWithShape()
        {
            InitializeComponent();
            double frequency;
            double[] shape = new double[51];
            double[] length = new double[51];
            int number;
            dataIO.ReadAns(out number, out frequency, out shape, out length);
            //读入数据
			showplot(number,length,shape);
			//显示振型
            this.textBoxFrequency.Text = frequency.ToString("0.00");
        }

		//振型的绘制
        private void showplot(int number,double[] length,double[] shape)
        {
            int i;
            Chart plot = new Chart();
            Series x = new Series("spline");
            ChartArea plotarea = new ChartArea();
            x.ChartType = SeriesChartType.Spline;
            x.BorderWidth = 2;x.ShadowOffset = 2;
            for (i = 0; i <= number; i++) x.Points.AddXY(length[i], shape[i]);
            plot.Series.Add(x);
            plotarea.BackColor = Color.Wheat;
            plotarea.AxisX.LabelStyle.Interval =1;
            plot.ChartAreas.Add(plotarea);
            plot.Location = new Point(30, 30);
            plot.Size = new System.Drawing.Size(500, 200);
            this.Controls.Add(plot);
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
